/*
 * Downloader.h
 *
 *  Created on: Mar 24, 2014
 *      Author: alexander
 */

#ifndef DOWNLOADER_H_
#define DOWNLOADER_H_

#include <string>
#include <iostream>
#include <vector>

class Downloader
{
public:
	Downloader();
	Downloader(std::string address, unsigned int port);
	void setProxyParams(std::string& address, unsigned int port);
	std::vector<std::string> fetchData(std::string url) const;
//	void fetchData(std::string url, std::vector<std::string>& fetchedData) const;

private:
	static const std::string HTTP_PREFIX;// = "http://";
	static const std::string HTTPS_PREFIX;// = "https://";

	std::string proxyAddress;
	unsigned int proxyPort;

	struct RequestData
	{
		std::string hostAddress;
		std::string httpRequest;
		RequestData(std::string addr, std::string req) : hostAddress(addr), httpRequest(req){}
	};

	static RequestData parseURL(std::string& url);
	static std::string removeURLPrefix(std::string& url);
};


#endif /* DOWNLOADER_H_ */
